/*	This program produces Table E2 */

***** Set directories 
local dir_clean 	"~/Dropbox/Retirement gaming/clean"
local dir_output 	"~/Dropbox/Retirement gaming/output/dataverse"


* Observed probabilities in retirement sample
use "`dir_clean'/retirsample_predictions.dta",  clear
keep i p*obs
forvalues x=0/7 {
	rename p`x'obs p`x'oprobit
}
g sample=0
tempfile probobs
save `probobs'

* Predicted probabilities in retirement sample
use "`dir_clean'/retirsample_predictions.dta",  clear
keep i p*oprobit
g sample=1
append using `probobs'
append using "`dir_clean'/mainsample_predictions.dta"
replace sample=2 if sample==.

* Observed probabilities in main analysis sample
label var p0oprobit "Prob. Retirement by 60"
forvalues i=1/6 {
	label var p`i'oprobit "Prob. Retirement at 6`i'"
}
label var p7oprobit "Prob. Retirement at 67+"

label define sample 0 "(1)" 1 "(2)" 2 "(3)"
label values sample sample
	
* Tabulate	
estimates clear
estpost tabstat p0oprobit p1oprobit p2oprobit p3oprobit p4oprobit p5oprobit p6oprobit p7oprobit, ///
	by(sample) 	statistics(mean sd) columns(statistics) listwise nototal

esttab . using "`dir_output'/tableE2.tex", replace f ///
	main(mean %5.3f) aux(sd %5.3f)  nostar unstack nonote  nonumber label nomtitles noobs nogaps 
	

clear

exit
